<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>
<script type="text/javascript">
	$(function(){
		$("#edit_resource_form").validate({
			success : function(label) {
				label.text("").addClass("validate_success");
			},
			rules : {
				name : {
					required : true,
					minlength : 2,
					maxlength : 50
				},
				type : {
					required : true,
					minlength : 2,
					maxlength : 50
				},
				value : {
					required : true,
					minlength : 2,
					maxlength : 500
				},
				module : {
					required : true,
					minlength : 2,
					maxlength : 50
				}
			},
			messages : {
				name : {
					required : "请输入名字",
					minlength : "请填写2个以上字",
					maxlength : "请填写20个以下的字"
				},
				type : {
					required : "请输入类型",
					minlength : "请填写2个以上字",
					maxlength : "请填写20个以下的字"
				},
				value : {
					required : "请输入值",
					minlength : "请填写2个以上字",
					maxlength : "请填写20个以下的字"
				},
				module : {
					required : "请输入模块",
					minlength : "请填写2个以上字",
					maxlength : "请填写20个以下的字"
				}
			},
			submitHandler : function() {
				$.post("/misc/admin/updateResource.htm", {
					id : $("#id").val(),
					name : $("#name").val(),
					type : $("#type").val(),
					value : $("#value").val(),
					module : $("#module").val(),
					description : $("#description").val()
				},function(data){
					if(data=="success"){
						parent.resGrid.loadData();
						parent.resDialog.close();
					}
					if(data=="error"){
						$.ligerDialog.warn("系统有点抽经，请稍候重试！");
					}
				});
			}
		});
	});
</script>
<%-- <form method="post" id="edit_resource_form" action="">
	<div style="height: 45px; border: 1px solid #505050;">
		<h4>
			<a href="javascript:void(0)"></a><span
				id="messageTitle" style="color: blue; font-size: 20">编辑资源</span>
		</h4>
	</div>
	<div style="height: 300px; border: 1px solid #505050">
		<input type="hidden" id="id" value="${resource.id}">
		<table>
			<tr>
				<td align="right">资源名称：</td>
				<td width="435"><input type="text" class="inputText"
					id="name" name="name" value="${resource.name}"/></td>
			</tr>
			<tr>
				<td align="right">资源类型：</td>
				<td><input class="inputText" type="text" id="type"
					name="type" value="${resource.type}"/>
				</td>
			</tr>
			<tr>
				<td align="right">资源：</td>
				<td><input class="inputText" type="text" id="value"
					name="value" value="${resource.value}"/>
				</td>
			</tr>
			<tr>
				<td align="right">所属模块：</td>
				<td><input class="inputText" type="text" id="module"
					name="module" value="${resource.module}"/>
				</td>
			</tr>
			<tr>
				<td align="right">资源描述：</td>
				<td><textarea id="description" name="description"
						class="inputText">${resource.description}</textarea></td>
			</tr>
		</table>
	</div>
	<div style="height: 50px; border: 1px solid #505050">
		<div onclick='javascript:parent.resDialog.close();' style="float: right; width: 150px">
			<strong style="font-size: 20; cursor: pointer;">关闭</strong>
		</div>
		<div onclick="javascript:$('#edit_resource_form').submit()" style="float: left; width: 150px">
			<strong style="color: red; font-size: 20; cursor: pointer;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;确定</strong>
		</div>
	</div>
</form> --%>
<form method="post" id="edit_resource_form" action="">
<input type="hidden" id="id" value="${resource.id}">
		<table width="100%" class="def_t">
			<tr>
				<td>资源名称：</td>
				<td><input type="text" id="name" name="name" value="${resource.name}"/></td>
			</tr>
			<tr>
				<td>资源类型：</td>
				<td><input type="text" id="type" name="type" value="${resource.type}"/></td>
			</tr>
			<tr>
				<td>资源：</td>
				<td><input type="text" id="value" name="value" value="${resource.value}"/></td>
			</tr>
			<tr>
				<td>所属模块：</td>
				<td><input type="text" id="module" name="module" value="${resource.module}"/></td>
			</tr>
			<tr>
				<td>资源描述：</td>
				<td><textarea id="description" name="description" cols="40">${resource.description}</textarea></td>
			</tr>
			<tr>
				<td colspan="2">
					<button onclick='javascript:parent.resDialog.close();'>关闭</button>
					<button type="submit" >确定</button>
				</td>
			</tr>
		</table>
</form>